{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Data Preparation and Advanced Model Evaluation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Agenda\n",
    "\n",
    "**Data preparation**\n",
    "\n",
    "- Handling missing values\n",
    "- Handling categorical features (review)\n",
    "\n",
    "**Advanced model evaluation**\n",
    "\n",
    "- ROC curves and AUC\n",
    "- Bonus: ROC curve is only sensitive to rank order of predicted probabilities\n",
    "- Cross-validation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Part 1: Handling missing values"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "scikit-learn models expect that all values are **numeric** and **hold meaning**. Thus, missing values are not allowed by scikit-learn."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(891, 11)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# read the Titanic data\n",
    "import pandas as pd\n",
    "url = 'https://raw.githubusercontent.com/justmarkham/DAT8/master/data/titanic.csv'\n",
    "titanic = pd.read_csv(url, index_col='PassengerId')\n",
    "titanic.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Survived      0\n",
       "Pclass        0\n",
       "Name          0\n",
       "Sex           0\n",
       "Age         177\n",
       "SibSp         0\n",
       "Parch         0\n",
       "Ticket        0\n",
       "Fare          0\n",
       "Cabin       687\n",
       "Embarked      2\n",
       "dtype: int64"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# check for missing values\n",
    "titanic.isnull().sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "One possible strategy is to **drop missing values**:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(183, 11)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# drop rows with any missing values\n",
    "titanic.dropna().shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(714, 11)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# drop rows where Age is missing\n",
    "titanic[titanic.Age.notnull()].shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Sometimes a better strategy is to **impute missing values**:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "29.69911764705882"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# mean Age\n",
    "titanic.Age.mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "28.0"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# median Age\n",
    "titanic.Age.median()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    24\n",
       "dtype: float64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# most frequent Age\n",
    "titanic.Age.mode()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# fill missing values for Age with the median age\n",
    "titanic.Age.fillna(titanic.Age.median(), inplace=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Another strategy would be to build a **KNN model** just to impute missing values. How would we do that?\n",
    "\n",
    "If values are missing from a categorical feature, we could treat the missing values as **another category**. Why might that make sense?\n",
    "\n",
    "How do we **choose** between all of these strategies?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Part 2: Handling categorical features (Review)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "How do we include a categorical feature in our model?\n",
    "\n",
    "- **Ordered categories:** transform them to sensible numeric values (example: small=1, medium=2, large=3)\n",
    "- **Unordered categories:** use dummy encoding (0/1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PassengerId</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17599</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C85</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101282</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113803</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>C123</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>373450</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Moran, Mr. James</td>\n",
       "      <td>male</td>\n",
       "      <td>28</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>330877</td>\n",
       "      <td>8.4583</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Q</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>McCarthy, Mr. Timothy J</td>\n",
       "      <td>male</td>\n",
       "      <td>54</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>17463</td>\n",
       "      <td>51.8625</td>\n",
       "      <td>E46</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Palsson, Master. Gosta Leonard</td>\n",
       "      <td>male</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>349909</td>\n",
       "      <td>21.0750</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg)</td>\n",
       "      <td>female</td>\n",
       "      <td>27</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>347742</td>\n",
       "      <td>11.1333</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Nasser, Mrs. Nicholas (Adele Achem)</td>\n",
       "      <td>female</td>\n",
       "      <td>14</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>237736</td>\n",
       "      <td>30.0708</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Survived  Pclass  \\\n",
       "PassengerId                     \n",
       "1                   0       3   \n",
       "2                   1       1   \n",
       "3                   1       3   \n",
       "4                   1       1   \n",
       "5                   0       3   \n",
       "6                   0       3   \n",
       "7                   0       1   \n",
       "8                   0       3   \n",
       "9                   1       3   \n",
       "10                  1       2   \n",
       "\n",
       "                                                          Name     Sex  Age  \\\n",
       "PassengerId                                                                   \n",
       "1                                      Braund, Mr. Owen Harris    male   22   \n",
       "2            Cumings, Mrs. John Bradley (Florence Briggs Th...  female   38   \n",
       "3                                       Heikkinen, Miss. Laina  female   26   \n",
       "4                 Futrelle, Mrs. Jacques Heath (Lily May Peel)  female   35   \n",
       "5                                     Allen, Mr. William Henry    male   35   \n",
       "6                                             Moran, Mr. James    male   28   \n",
       "7                                      McCarthy, Mr. Timothy J    male   54   \n",
       "8                               Palsson, Master. Gosta Leonard    male    2   \n",
       "9            Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg)  female   27   \n",
       "10                         Nasser, Mrs. Nicholas (Adele Achem)  female   14   \n",
       "\n",
       "             SibSp  Parch            Ticket     Fare Cabin Embarked  \n",
       "PassengerId                                                          \n",
       "1                1      0         A/5 21171   7.2500   NaN        S  \n",
       "2                1      0          PC 17599  71.2833   C85        C  \n",
       "3                0      0  STON/O2. 3101282   7.9250   NaN        S  \n",
       "4                1      0            113803  53.1000  C123        S  \n",
       "5                0      0            373450   8.0500   NaN        S  \n",
       "6                0      0            330877   8.4583   NaN        Q  \n",
       "7                0      0             17463  51.8625   E46        S  \n",
       "8                3      1            349909  21.0750   NaN        S  \n",
       "9                0      2            347742  11.1333   NaN        S  \n",
       "10               1      0            237736  30.0708   NaN        C  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titanic.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# encode Sex_Female feature\n",
    "titanic['Sex_Female'] = titanic.Sex.map({'male':0, 'female':1})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# create a DataFrame of dummy variables for Embarked\n",
    "embarked_dummies = pd.get_dummies(titanic.Embarked, prefix='Embarked')\n",
    "embarked_dummies.drop(embarked_dummies.columns[0], axis=1, inplace=True)\n",
    "\n",
    "# concatenate the original DataFrame and the dummy DataFrame\n",
    "titanic = pd.concat([titanic, embarked_dummies], axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Sex_Female</th>\n",
       "      <th>Embarked_Q</th>\n",
       "      <th>Embarked_S</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PassengerId</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Survived  Pclass                     Name   Sex  Age  SibSp  \\\n",
       "PassengerId                                                                \n",
       "1                   0       3  Braund, Mr. Owen Harris  male   22      1   \n",
       "\n",
       "             Parch     Ticket  Fare Cabin Embarked  Sex_Female  Embarked_Q  \\\n",
       "PassengerId                                                                  \n",
       "1                0  A/5 21171  7.25   NaN        S           0           0   \n",
       "\n",
       "             Embarked_S  \n",
       "PassengerId              \n",
       "1                     1  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titanic.head(1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- How do we **interpret** the encoding for Embarked?\n",
    "- Why didn't we just encode Embarked using a **single feature** (C=0, Q=1, S=2)?\n",
    "- Does it matter which category we choose to define as the **baseline**?\n",
    "- Why do we only need **two dummy variables** for Embarked?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.793721973094\n"
     ]
    }
   ],
   "source": [
    "# define X and y\n",
    "feature_cols = ['Pclass', 'Parch', 'Age', 'Sex_Female', 'Embarked_Q', 'Embarked_S']\n",
    "X = titanic[feature_cols]\n",
    "y = titanic.Survived\n",
    "\n",
    "# train/test split\n",
    "from sklearn.cross_validation import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=1)\n",
    "\n",
    "# train a logistic regression model\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "logreg = LogisticRegression(C=1e9)\n",
    "logreg.fit(X_train, y_train)\n",
    "\n",
    "# make predictions for testing set\n",
    "y_pred_class = logreg.predict(X_test)\n",
    "\n",
    "# calculate testing accuracy\n",
    "from sklearn import metrics\n",
    "print metrics.accuracy_score(y_test, y_pred_class)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Part 3: ROC curves and AUC"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# predict probability of survival\n",
    "y_pred_prob = logreg.predict_proba(X_test)[:, 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "plt.rcParams['figure.figsize'] = (8, 6)\n",
    "plt.rcParams['font.size'] = 14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.text.Text at 0x18bea128>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgIAAAGJCAYAAAD42ltKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xe4XFW5x/HvL6GHIhhI6BCkF0MJClIOAipIu+gVKSpV\nREUQLzZQYs0FqSpFIgEFIlVRej8oCT20S4cQQwmEnk5J3vvH2sdMhjkz+5wz9czv8zz7OTN7r733\nOzsnZ7+z1tprKSIwMzOz9jSg0QGYmZlZ4zgRMDMza2NOBMzMzNqYEwEzM7M25kTAzMysjTkRMDMz\na2NOBMzMzNpYXRMBSdtJ+oekFyXNk/S1HPtsLOkOSbOy/X5Sj1jNzMzaQb1rBAYBjwBHAbOBsqMZ\nSVoauBmYAmyR7XespGNqHKeZmVlbUKNGFpQ0HfhWRPy5TJkjgFHAkIh4N1t3HHBERKxSn0jNzMz6\nr2bvI7AV8K+uJCBz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yxyzlFOBDSXtmr1/GviKpPUljSDVlhQ/wlbqM/wc\n2C+73hspDZDzRUknljn3U6SnE7YsXClpWUnDSQkQwNqShpdpYshF0uGSzpK0s6S1JG2YxbcR8Lei\n4sdl13RDUr+Cd5mfLJ0IbCnpbEmbSvqYpN0knQMQEdOBM4BRSgP9rJX9O32jXHgVwh9Lqu35e/a7\nOEzSHuq+4+PzwOpZfIMlFdbojCbVMm1CQQfHAluSnprpU5ONNTcnAlZPQYnnwCPiUdKN/xhSW/XB\npKru4rKF7+eQemE/RGqTHUTqcNZlV+A20h+6J0lt7WuzYC/+XPEVOAi4l9Sx7B5gMeBzEfFuzpiK\nfQ/YgdQ+/UBRHPPfpLEH/sb85/0Lt00hfXOfR3ou/v+A32exvEsPZP8ON5OqxiH9OyyZxTYW+CMf\n/rb+oc8QETeRnpzYgXSd7gG+T/c95clqgi4htVMX2pP0Dfg20nUZnb0/vCefrYR7SP1Izia1+d8B\nbAt8JSL+UlT2h6Se9w+Q2v13y/5Nuq7ZdsAapEdUHyI9HfFKwf4/IiUMPwEeB64AVi4TW9mxEiJi\nFrA96VHFq7P4TyD9DpQ6xpXAdaRmnanAlwuO1Ul6nLEzIiaVON3upCY668eU1cSamTWU0siC9wBr\nRETD26Szb9i3kZ4k6GvHvKak9Bjki8C3ixMgSZsD15P+PWY1Ij6rD9cImFlTiIinSN+WPb59jSlZ\ngdQ5dxZwWYliPwZ+6SSg/3NnQTNrGhFxaKNjKNJfq0xXJ3WqfAE4KOtkuYCI+ELdo7KGcNOAmZlZ\nG3PTgJmZWRtzImBmZtbGnAiYmZm1MScCZmZmbcyJgJmZWRtzImBmZtbG/h9xF6DRzpLZmwAAAABJ\nRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x18be45f8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# plot ROC curve\n",
    "fpr, tpr, thresholds = metrics.roc_curve(y_test, y_pred_prob)\n",
    "plt.plot(fpr, tpr)\n",
    "plt.xlim([0.0, 1.0])\n",
    "plt.ylim([0.0, 1.0])\n",
    "plt.xlabel('False Positive Rate (1 - Specificity)')\n",
    "plt.ylabel('True Positive Rate (Sensitivity)')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.838692434211\n"
     ]
    }
   ],
   "source": [
    "# calculate AUC\n",
    "print metrics.roc_auc_score(y_test, y_pred_prob)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Besides allowing you to calculate AUC, seeing the ROC curve can help you to choose a threshold that **balances sensitivity and specificity** in a way that makes sense for the particular context."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([<matplotlib.axes._subplots.AxesSubplot object at 0x0000000018BE8390>,\n",
       "       <matplotlib.axes._subplots.AxesSubplot object at 0x0000000018EA0198>], dtype=object)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAfYAAAF9CAYAAAD2nEqnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGqJJREFUeJzt3X+Q5HV95/HnGyhYRJLg4c1KKjAQPA0xJ3qHp9wirXXZ\nUy5V510umnBJVhTXGMiGUKmjxAVZzwsWpCIm4bTwvNMih/lZUFSMBrzQcmH5KcQkcCgUOxzLsrsm\n8RZkQXH3fX98vwPNOLvdM/3t+X7n089HVdd0f7/94zU98/28ur/97e83MhNJklSGQ9oOIEmSmmOx\nS5JUEItdkqSCWOySJBXEYpckqSAWuyRJBbHYJUkqiMU+ZSLiiIj4WEQ8HhF7I+LOiFjfdi5JKy8i\njoqILRHxZxHxzYjYHxEXtZ1L47HYp89ngQuB/wlsAp4DvhARb24zl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hDGYbzyTGA8m\nsVX8TmAdB9737ulUq0TaciXwyYh4A9Vqmfnd980A66mOlHRBO9GA7j9/0P2MXc+3A/jVzPyTxWbO\nr3pb2UgT1fW/h2PCeMw3nsbHg0kUe6cXksz8rxHx91QHtn8PMP8qaB/wVeAXMvMP28pHx5+/Wtcz\ndj3fvVSHslx0QS5Qp/8ejgljM994mh8PlnKM11FPVDvUvxN4jmr1wv76/B3AOyfxmMvMeThwXH06\nvO08q+n563rGLuejOvzm2w8y/yig1/ZzOC1/jwU5HRPMt9LZGh8PJvo99og4HDi2vvh3WR2hSCNa\nDc9f1zN2Pd+08e8xnq4/f+brhqncQY0kSaUq4us0kiSpYrFLklQQi12SpIJY7JIkFeT/Ax7uzfbb\ngKmoAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x18beaf28>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# histogram of predicted probabilities grouped by actual response value\n",
    "df = pd.DataFrame({'probability':y_pred_prob, 'actual':y_test})\n",
    "df.hist(column='probability', by='actual', sharex=True, sharey=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "What would have happened if you had used **y_pred_class** instead of **y_pred_prob** when drawing the ROC curve or calculating AUC?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1928dcc0>]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAe8AAAF2CAYAAABH4BBGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XuQXOV55/HvgySEQFysC7qChQAjIYQFSNx0GyGIE+wt\npxyXvanEsb2xy8EuO1nXst4EE5Qtlym7UsROrWPHFcdkXc4FO1XOZ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ngb8A\nLuj8+BPVK7WwhnOO9wFnUko7ujy3o/N9Lq94hY1hOOf5U8DulNIXUkpbU0rrgd8ElpNN+Wpkhp15\nVQvvlNJbQOnWql3dRbbCsTcbgaURMbbH8b3eWrXZDfMcExHLyIL7gZTSn1avwuIb5jm+Dnh3l8cf\nkq08fTfww+pUWlzDPMftwOjOkWHJbLJpYX9W9GKY5znIFqd1Vfq43mZui2j4mVfl1XYfAk4Bvw3M\nBb4OvAFc1vn5B4HVXY6/iOw3wL8h66t8ADgC/Ne8Vw7W62MY57iFbLOZr5D9hje18zE57++lXh9D\nPce9vP5juNq8oueYLFS2UL6E6Qayy8Q25P291PNjGOd5Cdlo/X7garIFb/8X2AWMy/v7qbcH2aVi\nCzofxzvP24JqZF4tvpl7gFfIFjs8CSzp8rnvAjt7HH9d5/+EJ4G9ZNO6uf9HqefHUM5x58cdZL89\nd33srHXdRXoM9d9xj9d+DHgj7++h3h/D+FkxFXikM3z2k6018JfQyp/nD3b+onS08zz/CJiT9/dR\njw+ywVHpZ2rXn7N/2c/5HVbmeXtUSZIKxp6FJEkFY3hLklQwhrckSQVjeEuSVDCGtyRJBWN4S5JU\nMIa3JEkFY3hLklQwhrckSQXz/wG/vscK1b4htAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x18cda358>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# ROC curve using y_pred_class - WRONG!\n",
    "fpr, tpr, thresholds = metrics.roc_curve(y_test, y_pred_class)\n",
    "plt.plot(fpr, tpr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.780962171053\n"
     ]
    }
   ],
   "source": [
    "# AUC using y_pred_class - WRONG!\n",
    "print metrics.roc_auc_score(y_test, y_pred_class)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If you use **y_pred_class**, it will interpret the zeros and ones as predicted probabilities of 0% and 100%."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Bonus: ROC curve is only sensitive to rank order of predicted probabilities"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.84499501,  0.07452707,  0.85089451,  0.62517562,  0.87679784,\n",
       "        0.09611294,  0.13614004,  0.90132983,  0.61102779,  0.62517562])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# print the first 10 predicted probabilities\n",
    "y_pred_prob[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.9192361 ,  0.27299647,  0.92243943,  0.79068048,  0.93637484,\n",
       "        0.31002087,  0.3689716 ,  0.94938392,  0.78168267,  0.79068048])"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# take the square root of predicted probabilities (to make them all bigger)\n",
    "import numpy as np\n",
    "y_pred_prob_new = np.sqrt(y_pred_prob)\n",
    "\n",
    "# print the modified predicted probabilities\n",
    "y_pred_prob_new[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([<matplotlib.axes._subplots.AxesSubplot object at 0x0000000019279EB8>,\n",
       "       <matplotlib.axes._subplots.AxesSubplot object at 0x00000000193EB630>], dtype=object)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAfUAAAF9CAYAAAAdq/GkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHlhJREFUeJzt3XnUZHV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W1Jmvtm6v3A5//y1mca0OOZWxgudHHPX6s6kNl9fHewJ\nXesH0L0xd/F1u6rarWxTj4gjqPYGPIZqoz9UO1ZcAnw4x/z1tq7VbZNjVle0+bjbEypdGy90c8xd\n0HioR8QW4MtUD84FVF8ngOroTr9G9eCdsNo9ELtWd6B+40/cNsfcYpPs4pjXvOnUt/n2zBznwBsz\np+XHvXM9oWv9oItjLqkfDNzuintCG6H+barv671+keXvA47JzFUdeKFrdevrttV02rov2nyhdWrM\nbTfKJW73aOBvM3Ma+7s0ruXXV6d6Qtf6QRfHXFo/qG97VT2hjVC/Ezg6M0cetSciHgtckZkbS65b\nX7etJ25b90WbzaFTY26x7sksfeSpI6nelZcS6m2+vjrVE7rWD7o45q71g/q6zfaEbP6IPtcDr1xi\n+SuB60uvW1/3TuDRSyx/LHDXrIy5rfF2ccwt1h38Ra5Rp9sZ81fLZvHU8uurUz2ha/2gi2PuWj+o\nr9toT2hj7/ezgQ9FxNOppim21pcfAhxH9UtEv7cO6kJ1RKAtLH6s4WOopnNWq60xtzVe6N6Y26p7\nM/CGzPzsqIV7p9rGqDur2nx9da0ndK0fQPfG3LV+AE33hHHeWazgncdJwN9QHSt374+976L6Ld4T\n11Hd11Idh/hPgOdTPSm21H//CdWPALxmVsbc5ni7NuYW654HnLnE8qMZ86dIZ/XU1uurzdpdeq62\nfD90asxd6wd17UZ7wtgvphUOdn/gsPq0/3qs22ZDa2PMbY+3S2NuqekcCzx3ieWbgF4T9/Osndp6\n3bZZuyvP1Tbvh66NuUv9oK7baE/w2O9rJCL2Bx5Sn/1xZu6c5niW07XxQntj7uJ9odnWxedU18a8\nXvuBoS5JUiGK+NqMJEky1CVJKoahLklSIQx1SZIK8f8BjgQNUVaf8ocAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x18ccf7f0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# histogram of predicted probabilities has changed\n",
    "df = pd.DataFrame({'probability':y_pred_prob_new, 'actual':y_test})\n",
    "df.hist(column='probability', by='actual', sharex=True, sharey=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x19950320>]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAe8AAAF2CAYAAABH4BBGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHQ1JREFUeJzt3XuUHGWd//H3NwGCRhAlkATkFkRjuAWWuBK5DGpEIoir\nrMh6A5HDIiIuZ9HfEZDoeowgBlBDMGhAWVFurndCCDLRJCBEBFGRywLLxZiQwy1XNOH5/VE9ZBhn\nMj093V39TL9f59SZ6eqnur/9EObTVfXUU5FSQpIk5WNY2QVIkqSBMbwlScqM4S1JUmYMb0mSMmN4\nS5KUGcNbkqTMGN6SJGWm3/COiEMi4icR8XhEvBARH6lim70jYkFErKlsd059ypUkSdXseY8Efg+c\nDqwFNjmrS0RsDdwELAUOqGx3ZkScMbhSJUkSQAxkhrWIWAmcmlL67ibanAJMB0anlJ6vrDsLOCWl\n9JpB1itJUttrxDnvA4FfdwV3xTxgh4jYpQHvJ0lSW2lEeI8BlvVYt6zbc5IkaRAaEd7e6USSpAba\nrAGv+Vf+cQ97dLfnXiIiDHtJUltJKcVgtm/EnvetwMERMaLbuinAEyml/+ttg5SSSwOXc889t/Qa\nhvpiH9vPQ2Wxj2tbJkxI/OEP1bWth2qu8x4ZERMjYmKl/S6VxztVnp8eEfO7bXIVsAa4IiL2jIj3\nAJ8BZtSlYkmS2lw1h80nAb+s/J6Az1eWK4CPUhwiH9fVOKX0XERMAWYCS4CngAtSShfWr2xJUrv5\n3/+FvfeG9evLruQfpQQjRzbv/foN75RSJ5vYQ08pndDLuj8Ahw6qMtVNR0dH2SUMefZ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FIeDr/FLUl3UnHmNDO8VwAZgdI/1oylOzvfmr/zjt43R3Z7T\nS9XSxwBURpj+AjgnpfTNxpQ3JNTSx4cB50bE3yPi78C3gJGVxx9rXKnZqqWPlwLrU0oPdlv3YOV1\ndq57hUNDLf18MvBYSukzKaW7U0q/Bj4IHEpxyFeDU3PmNSy8U0p/A7qmVu1uCsUIx97cChwcESN6\ntO91atV2V2MfExGHUAT3uSmlrzWuwvzV2Md7Aft2Wz5HMfJ0X+C6xlSarxr7eCGwWWXPsMs4isPC\n/q3oRY39HBSD07rretxqR25zVHvmNXi03fuA54ETgTcAFwPPATtVnp8OzO/WfmuKb4Dfpziv8h7g\nWeA/yh452KpLDX3cQXGzmfMovuGNqSzblf1ZWnUZaB/3sv3xONq8rn1MESpL2HgJ034Ul4ktLvuz\ntPJSQz8fRLG3fg6wB8WAt7nAI8DLyv48rbZQXCo2sbKsrvTbxEZkXjM+zCnAwxSDHe4ADur23OXA\nQz3a71X5n3At8ATFYd3S/6O08jKQPq483kDx7bn78lCz685pGei/4x7bHg88V/ZnaPWlhr8VY4Br\nKuGzjGKsgV9C69/Px1S+KK2s9POPgPFlf45WXCh2jrr+pnb/OztnE/1bU+Y5PaokSZnxnIUkSZkx\nvCVJyozhLUlSZgxvSZIyY3hLkpQZw1uSpMwY3pIkZcbwliQpM4a3JEmZ+f9GOky3IBqCYAAAAABJ\nRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1969a748>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# ROC curve did not change\n",
    "fpr, tpr, thresholds = metrics.roc_curve(y_test, y_pred_prob_new)\n",
    "plt.plot(fpr, tpr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.838692434211\n"
     ]
    }
   ],
   "source": [
    "# AUC did not change\n",
    "print metrics.roc_auc_score(y_test, y_pred_prob_new)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Part 4: Cross-validation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.84782357185298385"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# calculate cross-validated AUC\n",
    "from sklearn.cross_validation import cross_val_score\n",
    "cross_val_score(logreg, X, y, cv=10, scoring='roc_auc').mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.84604951475539703"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# add Fare to the model\n",
    "feature_cols = ['Pclass', 'Parch', 'Age', 'Sex_Female', 'Embarked_Q', 'Embarked_S', 'Fare']\n",
    "X = titanic[feature_cols]\n",
    "\n",
    "# recalculate AUC\n",
    "cross_val_score(logreg, X, y, cv=10, scoring='roc_auc').mean()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
